<%@ page import="java.io.File" %>
<%@ page import="java.net.URLEncoder" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/8/26
  Time: 18:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%
        String workerNo=(String) session.getAttribute("workerNo");
        String courseNo=(String) session.getAttribute("courseNo");
        String dirName=request.getParameter("dirName");
        String filePath="F:\\JWGLXT\\web\\StoreResoures\\"+workerNo+"\\"+courseNo;
    %>
    <title>知识点管理</title>
    <link href="/SystemerNav/SystemerNav.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

</head>
<body background="/LoginInterface/loginFace.jpg">
<div class="container">
    <div class="top">
        <label>添加知识点</label>
        <form class="form-inline" action="/TeachLesson/AddKonwServlet"><hr>
            <div class="form-group">
                <label for="exampleInputName2">知识点名</label>
                <input type="text" class="form-control" id="exampleInputName2" placeholder="知识点" name="point">
                <input type="hidden" name="workerNo" value="<%=workerNo%>">
                <input type="hidden" name="courseNo" value="<%=courseNo%>">
                <input type="hidden" name="dirName" value="<%=dirName%>">
            </div>

            <button type="submit" class="btn btn-default">添加</button>
        </form>
    </div>
<div class="bottom">
    <table class="table table-hover">
        <tr>
            <td>知识点</td>
            <td>详细</td>
        </tr>
        <%
           String filePaths=filePath+'/'+dirName;
           File file=new File(filePaths);
           if(!file.exists()){
               //如果文件夹不存在则创建之
               file.mkdirs();
           }
           String [] f_arry=file.list();
           if(file.isDirectory()){
           for (int i=0;i<f_arry.length;i++) {
               %>
       <tr>
           <td><%=f_arry[i]%></td>
           <td>
               <form action="knowledgeResourses.jsp">
                   <input type="hidden" name="dirName" value="<%=dirName%>">
                   <input type="hidden" name="point" value="<%=f_arry[i]%>">
                   <button type="submit" class="btn btn-success">相关资料</button>
               </form>
           </td>
       </tr>


        <%
           }

           }
        %>
    </table>
</div>
</div>
</body>
</html>
